/* 
	ZClub Coffee
*/
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "freertos/queue.h"
#include "esp_system.h"
#include "driver/gpio.h"
#include "nvs_flash.h"
#include "esp_wifi.h"
#include "esp_wpa2.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "esp_smartconfig.h"
#include "esp_websocket_client.h"
#include "driver/ledc.h"
#include "esp_err.h"
#include "esp_log.h"
#include "lwip/apps/netbiosns.h"
#include "esp_event_loop.h"
#include "esp_http_server.h"
#include "esp_spiffs.h"
#include "esp_vfs.h"
#include "cJSON.h"
#include "mdns.h"

// LVGL
#include "lvgl/lvgl.h"
#include "lvgl_esp32_drivers/lvgl_helpers.h"
#include "lvgl_esp32_drivers/lvgl_touch/xpt2046.c"
#include "rotary_encoder/include/rotary_encoder.h"
#include "lv_lib_qrcode/lv_qrcode.h"
#include "lv_lib_qrcode/lv_qrcode.c"

// 项目文件
#include "coffee_lib/config.h"
#include "coffee_lib/var.h"
#include "coffee_lib/settings.h"
#include "coffee_lib/status.h"
#include "coffee_lib/data.h"
#include "coffee_lib/util.h"
#include "coffee_lib/code.h"
#include "coffee_lib/rot.h"
#include "ui/ui.h"
#include "coffee_lib/note_lib.h"
#include "coffee_lib/settings_web_server.h"
#include "coffee_lib/fs.h"
#include "coffee_lib/bee.h"
#include "coffee_lib/ws.h"
#include "coffee_lib/key.h"
#include "coffee_lib/nvs.h"
#include "coffee_lib/wifi.h"
#include "coffee_lib/settings_web_server.h"
#include "coffee_lib/event.h"

void app_main() {
	wsDataQ		= xQueueCreate(20, sizeof(char *));
	inputQ		= xQueueCreate(20, sizeof(char *));
	eventGroup	= xEventGroupCreate();
	lvMutex		= xSemaphoreCreateMutex();
	eventInit();

	// LVGL UI初始化
	xTaskCreatePinnedToCore(uiInitTask, "uiInitTask", MEM_UNIT * 10, NULL, 0, NULL, 1);
	// 初始化电键
	xTaskCreatePinnedToCore(keyInitTask, "keyInitTask", MEM_UNIT * 4, NULL, 0, NULL, 1);
	// 初始化旋转编码器
	xTaskCreatePinnedToCore(rotInit, "rotInit", MEM_UNIT * 4, NULL, 0, NULL, 1);
	
	// sysShowTaskInfo();
	// sysShowHeap();
}